import { PageContainer } from '@ant-design/pro-components';
import { Access, useAccess,useModel } from '@umijs/max';
import { Button } from 'antd';
import { useIntl,FormattedMessage } from '@umijs/max';

const AccessPage: React.FC = () => {
  const { name,setName } = useModel('global');
  const intl = useIntl();
  const access = useAccess();
  console.log('====access======',access);
  return (
    <PageContainer
      ghost
      header={{
        title: intl.formatMessage({ id: 'menu.admin'}),
      }}
    >
      {name}
      <Access accessible={access.canSeeAdmin}>
        <Button><FormattedMessage id="pages.btn1" defaultMessage="只有 Admin 可以看到这个按钮" />aaaa</Button>
      </Access>
    </PageContainer>
  );
};

export default AccessPage;
